﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class DAL_ChiTietHoaDon
    {
        Connect da = new Connect();
        public DataTable showchitietHD()
        {
            string sql = "select * from ChiTietHD";
            DataTable dt = new DataTable();
            dt = da.GetTable(sql);
            return dt;
        }
        public void insertchitietHD(string mhd, string mmh, string dg, string sl)
        {
            string sql = "insert ChiTietHD values('" + mhd + "',N'" + mmh + "','" + dg + "','" + sl + "')";
            da.Excutenonquery(sql);

        }
        public void UpdatechitietHD(string mhd1, string mhd, string mmh, string dg, string sl)
        {
            string sql = "UPDATE ChiTietHD SET MaHD='" + mhd + "',MaMH='" + mmh + "',DonGia='" + dg + "',SoLuong='" + sl + "' where MaHD='" + mhd1 + "'";
            da.Excutenonquery(sql);

        }
        public void DeletechitietHD(string mhd_d)
        {
            string sql = "delete ChiTietHD WHERE MaHD='" + mhd_d + "'";
            da.Excutenonquery(sql);

        }
    }
}
